export default {

  SET_TOKEN(state,token){
    state.token = token
    //浏览器关闭的时候也可以存在 浏览器的localStorage中
    localStorage.setItem("token",token)
  },
  SET_USERINFO(state,userInfo){
    state.userInfo = userInfo
    sessionStorage.setItem("userInfo",JSON.stringify(userInfo))
  },
  SET_PERMISSIONS(state,permissions){
    state.permissions = permissions
    sessionStorage.setItem("permissions",JSON.stringify(permissions))
  },
  SET_MENULSIT(state,menuList){
    state.menuList = menuList
    sessionStorage.setItem("menuList",JSON.stringify(menuList))
  },
  SET_ROLELIST(state,roleList){
    state.roleList = roleList
    sessionStorage.setItem("roleList",JSON.stringify(roleList))
  },

  SET_ROUTER(state,router){
    state.router = router
    localStorage.setItem("router",JSON.stringify(router))
  },

  REMOVE_INFO(state){
    state.token = '';
    state.userInfo = {};
    localStorage.setItem("token",'');
    sessionStorage.setItem("userInfo",JSON.stringify(''))
    sessionStorage.setItem("permissions",JSON.stringify(''))
    sessionStorage.setItem("menuList",JSON.stringify(''))
    sessionStorage.setItem("roleList",JSON.stringify(''))

    localStorage.setItem("roleList",JSON.stringify(''))
  }

}
